import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: 'login'
    },
    {
      path: '/login',
      component: () => import('../views/LoginView.vue'),
      meta: {
        title: '高新园区物业-登录'
      }
    },
    {
      path: '/test',
      component: () => import('../views/TestView.vue'),
      meta: {
        title: '功能测试页面'
      }
    },
    {
      path: '/manager',
      component: () => import('../views/manager/ManagerView.vue'),
      meta: {
        title: '高新物业-管理端'
      },
      children: [
        {
          path: 'statistics',
          component: () => import('../views/manager/statistics/DataOverviewView.vue')
        },
        {
          path: "orgMng",
          component: () => import('../views/manager/file/OrgManageView.vue')
        },
        {
          path: "houseMng",
          component: () => import('../views/manager/file/HouseManageView.vue')
        },
        {
          path: "employeeMng",
          component: () => import('../views/manager/file/EmployeeManageView.vue')
        },
        {
          path: "tenantMng",
          component: () => import('../views/manager/file/TenantManageView.vue')
        },
        {
          path: 'workorderMng',
          component: () => import('../views/manager/property/WorkOrderManageView.vue')
        },
        {
          path: 'workorderCfg',
          component: () => import('../views/manager/property/WorkOrderConfigView.vue')
        },
        {
          path: 'patroltask',
          component: () => import('../views/manager/property/PatrolTaskView.vue')
        },
        {
          path: 'patrolplan',
          component: () => import('../views/manager/property/PatrolPlanView.vue')
        },
        {
          path: 'managerMng',
          component: () => import('../views/manager/system/ManagerManageView.vue')
        },
        {
          path: 'dataTypeMng',
          component: () => import('../views/manager/system/DataTypeManageView.vue')
        },
        {
          path: 'systemLog',
          component: () => import('../views/manager/system/SystemLogView.vue')
        }
      ]
    },
    {
      path: '/employee',
      component: () => import('../views/employee/EmployeeView.vue'),
      meta: {
        title: '高新物业-员工端'
      },
      children: [
        {
          path: 'mainemployee',
          component: () => import('../views/employee/MainEmployeeView.vue')
        },
        {
          path: 'myacceptedworkorder',
          component: () => import('../views/employee/MyAcceptedWorkorderView.vue')
        },
        {
          path: 'mypatroltask',
          component: () => import('../views/employee/MyPatrolTaskView.vue')
        }
      ]
    },
    {
      path: '/tenant',
      component: () => import('../views/tenant/TenantView.vue'),
      meta: {
        title: '高新物业-租户端'
      },
      children: [
        {
          path: 'maintenant',
          component: () => import('../views/tenant/MainTenantView.vue')
        },
        {
          path: 'myhouse',
          component: () => import('../views/tenant/MyHouseView.vue')
        },
        {
          path: 'myworkorder',
          component: () => import('../views/tenant/MyWorkOrderView.vue')
        }
      ]
    }
  ]
})

export default router
